#include<iostream>
#include<math.h>

using namespace std;

int main(){
    int i, j;
    int Cout = 0;
    for(i = 2; i <= 20000; i ++){
        for(j = 2; j <= sqrt(i); j ++){
            if(i%j == 0) break;
        }
        if(j>sqrt(i)){
            cout << i << " ";
            Cout++;
            if(Cout == 5){
                cout << endl;
                Cout = 0;
            }
        }
        
            
    }
    return 0;
}